//////////////////////////////////////////////////////////////////////////
#pragma once
#pragma managed
//////////////////////////////////////////////////////////////////////////
NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////
public ref class ManagedPyramid : NativeHandleObject
{
public:

protected:
	virtual void ReleaseHandle() override
	{
		CvMat** ppMat = this->ToCvMatPointerPointer();
		cvReleasePyramid(&ppMat, m_nLayers);
		m_pHandle = ppMat;
	}

internal:
	ManagedPyramid(CvMat** handle, int layers, bool own) : NativeHandleObject(handle, own)
	{
		m_nLayers = layers;
	}

	inline CvMat** ToCvMatPointerPointer()
	{
		return (CvMat**)m_pHandle;
	}

private:
	int m_nLayers;
};

public ref class ManagedStereoBMState : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvStereoBMState* pStereoBMState = this->ToCvStereoBMStatePointer();
		cvReleaseStereoBMState(&pStereoBMState);
		m_pHandle = pStereoBMState;
	}

internal:
	ManagedStereoBMState(CvStereoBMState* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvStereoBMState* ToCvStereoBMStatePointer()
	{
		return (CvStereoBMState*)m_pHandle;
	}
};

public ref class ManagedStereoGCState : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvStereoGCState* pStereoGCState = this->ToCvStereoGCStatePointer();
		cvReleaseStereoGCState(&pStereoGCState);
		m_pHandle = pStereoGCState;
	}

internal:
	ManagedStereoGCState(CvStereoGCState* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvStereoGCState* ToCvStereoGCStatePointer()
	{
		return (CvStereoGCState*)m_pHandle;
	}
};


public ref class ManagedLSH : public NativeHandleObject
{

protected:
	virtual void ReleaseHandle() override
	{
		CvLSH* pLSH = this->ToCvLSHPointer();
		cvReleaseLSH(&pLSH);
		m_pHandle = pLSH;
	}

internal:
	ManagedLSH(CvLSH* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvLSH* ToCvLSHPointer()
	{
		return (CvLSH*)m_pHandle;
	}
};

public ref class ManagedLSHOperations abstract: public NativeHandleObject
{

protected:
	virtual void ReleaseHandle() override
	{
		CvLSHOperations* pLSHOperations = this->ToCvLSHOperationsPointer();
		m_pHandle = pLSHOperations;
	}

internal:
	ManagedLSHOperations(CvLSHOperations* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvLSHOperations* ToCvLSHOperationsPointer()
	{
		return (CvLSHOperations*)m_pHandle;
	}
};

public ref class ManagedPOSITObject : public NativeHandleObject
{

protected:
	virtual void ReleaseHandle() override
	{
		CvPOSITObject* pPOSITObject = this->ToCvPOSITObjectPointer();
		cvReleasePOSITObject(&pPOSITObject);
		m_pHandle = pPOSITObject;
	}

internal:
	ManagedPOSITObject(CvPOSITObject* handle, bool own) : NativeHandleObject(handle, own)
	{
	}

	inline CvPOSITObject* ToCvPOSITObjectPointer()
	{
		return (CvPOSITObject*)m_pHandle;
	}
};

//////////////////////////////////////////////////////////////////////////
NAMESPACE_END
//////////////////////////////////////////////////////////////////////////